package com.freewater.cargotracker.domain.model.paint;

public class PigmentColor {

    private int read;
    private int yellow;
    private int green;

    public PigmentColor(int read, int yellow, int green) {
        this.read = read;
        this.yellow = yellow;
        this.green = green;
    }

    PigmentColor mixedWith(PigmentColor other, double ratio) {
        int newRed = (int) (this.read + other.getRead() * ratio);
        int newYellow = (int) (this.yellow + other.getYellow() * ratio);
        int newGreen = (int) (this.green + other.getGreen() * ratio);
        PigmentColor pigmentColor = new PigmentColor(newRed, newYellow, newGreen);
        return pigmentColor;
    }

    public int getRead() {
        return read;
    }

    public int getYellow() {
        return yellow;
    }

    public int getGreen() {
        return green;
    }

    @Override
    public String toString() {
        final StringBuffer sb = new StringBuffer("PigmentColor{");
        sb.append("read=").append(read);
        sb.append(", yellow=").append(yellow);
        sb.append(", green=").append(green);
        sb.append('}');
        return sb.toString();
    }
}
